<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sj:head jqueryui="true" jquerytheme="redmond"/>
<script type="text/javascript">
	function okButton() {
		alert('OK Button pressed!');
	};
	function cancelButton() {
		alert('Cancel Button pressed!');
		$('#mybuttondialog').dialog('close');
	};

	$.subscribe('rowselect', function(event, data) {
		/* var grid = event.originalEvent.grid;
		var sel_id = grid.jqGrid('getGridParam', 'selrow');
		var name = grid.jqGrid('getCell', sel_id, 'name');
		window.location="trustDistrictDetailAction.action"; */
		var grid = event.originalEvent.grid;
		var sel_id = grid.jqGrid('getGridParam', 'selrow');
		var isActive = grid.jqGrid('getCell', sel_id, 'isActive');	
		if(isActive == "No"){
			alert("Do you want to make this Geography active?");	
		}	
		else{
			window.location="trustDistrictDetailAction.action";
		}
	});
	
	function onButtonClick(){
		window.location = "listTrustRegionPageAction.action";
	}
	function onButtonClick2(){
		window.location = "toRegionDetailPageAction.action";
	}
	
	function onCreateClick(){
		window.location="trustDistrictDetailAction.action";
	}
	
	function onClickSave(){
		window.location="addTrustRegionActionn.action";
	}
	
</script>
</head>
<body>
	<p><b>Trust Region Detail</b></p>
	<s:url id="editurl" action="nedit" />
	<s:url id="remoteurl" action="ntable" />


	<sj:tabbedpanel id="localtabs">
		<sj:tab id="tab1" target="tone" label="Details" />
		<sj:tab id="tab3" target="tthree" label="Trust Districts" />

		<div id="tone">
		<table width="100%">
		<tr><td align="right">
		<%--  <sj:submit 
    	formIds="formSelectOne" 
    	targets="result" 
    	effect="pulsate" 
    	value="Save" 
    	indicator="indicator" 
    	button="true"/> --%>
    	<sj:a button="true"  >Deactive</sj:a>
<%--     	<sj:a button="true"  >Save</sj:a>
 --%>    	<sj:a formIds="formSelectOne" button="true" onclick="onClickSave()">Save</sj:a>
			<sj:a button="true" onclick="onButtonClick()" >Back</sj:a>
    	</td>

    </tr>
		</table>
		<% String numTrustRegion= (String) request.getParameter("trustRegionId");
			int trustRegionId=-1;	
		if(numTrustRegion!=null){
				trustRegionId=Integer.parseInt(numTrustRegion);
			}
		%>
		
		<s:form id="formSelectOne" action="addTrustRegionAction" theme="simple" cssClass="yform">
        <fieldset>
            <legend>Details</legend>
	        	<table>
				<s:url id="remoteurl1" action="selectCountryAction"/> 
				<tr>
				<s:hidden id="trustRegionId" name="trustRegionId"/>
				<td>
				Nation/Country
				</td>
				<td>
				<sj:select 
					href="%{remoteurl1}" 
					id="countryId" 
					name="countryId" 
					list="countryMap" 
					emptyOption="true" 
					headerKey="-1" 
					headerValue="Please Select a Country"
					
				/>
				
			<%-- <div class="type-button">
				<sj:submit 
					targets="result2" 
					value="AJAX Submit" 
					indicator="indicator"
					button="true"
				/>
				<img id="indicator" 
					src="images/indicator.gif" 
					alt="Loading..." style="display:none"
				/>
	        </div> --%>
	        
				</td>
				</tr>
				<tr>	
				<td>
				Trust Region Name
				</td>
				<td>
				
				 <sj:textfield href="%{urlsimpleecho}" id="trustRegionName" name="trustRegionName" size="25"/>
				</td>
				</tr>
				<tr>
				<td>
				Description
				</td>
				<td>
				 <sj:textarea id="description" label="Description"
        		 name="description" rows="5" cols="23" />
				</td>
				</tr>
	        </table>
        </fieldset>
    </s:form>
  
	</div>	
		<div id="tthree">
			<table width="100%">
		<tr><td align="left"> 
		
        
        	<sj:a button="true">Deactive</sj:a>
        	<sj:a button="true" >Save</sj:a>
        	<sj:a button="true" onclick="onButtonClick2()" >Back</sj:a>
    
    	</td>

    </tr>
		</table>
				
		<br>
			<%-- <s:form action="trustDistrictDetailAction" theme="simple"> --%>
			<table >
	<tr>
		<td><a href="<s:url action="geographyAllSearch"/>" >All</a></td>
		<td><a href="<s:url action="geography09Search"/>" >0-9</a></td>
		<td><a href="<s:url action="geographyAESearch"/>" >A B C D E</a></td>
		<td><a href="<s:url action="geographyFJSearch"/>" >F G H I J</a></td>
		<td><a href="<s:url action="geographyKNSearch"/>" >K L M N</a></td>
		<td><a href="<s:url action="geographyORSearch"/>" >O P  Q R</a></td>
		<td><a href="<s:url action="geographySVSearch"/>" >S T U V</a></td>
		<td><a href="<s:url action="geographyWZSearch"/>" >W X Y Z</a></td>
		<td> <%-- <s:submit value="Create" method="create"></s:submit> --%>
		<sj:a button="true" onclick="onCreateClick()" >Create</sj:a>
		 <s:checkbox name="includeInactive">Include In-active</s:checkbox></td>
		 
	</tr>
	</table>
	<br>
	<s:url id="listTrustDistrictsUrl" action="listTrustDistrictsAction" />
	<sjg:grid id="gridtable" caption="Customer Examples" dataType="json"
		href="%{listTrustDistrictsUrl}" pager="true" gridModel="gridModel"
		rowNum="15" rownumbers="true" 
		onSelectRowTopics="rowselect">
		<sjg:gridColumn name="name" index="name" title="District Name" sortable="false" />
		<sjg:gridColumn name="description" index="description" title="Description" sortable="false" />
		<sjg:gridColumn name="trustRegionId" index="trustRegionId" title="Region" sortable="false" />
		<%-- <sjg:gridColumn name="contact" index="contact" title="Contact" sortable="false" /> --%>
		<sjg:gridColumn name="status" index="status"  title="Is Active?" sortable="false"  />
	</sjg:grid>
<%-- </s:form> --%>
		</div>
	</sj:tabbedpanel>
</body>
</html>